using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace VGS {
    class LineupEnum : IEnumerator {
        private Player[] _players;
        private const int LINEUP = 6;

        // Enumerators are positioned before the first element
        // until the first MoveNext() call.
        int position = -1;

        public LineupEnum(Player[] list) {
            _players = list;
        }

        public bool MoveNext() {
            position++;
            return (position < LINEUP);
        }

        public void Reset() {
            position = -1;
        }

        public object Current {
            get {
                try {
                    return _players[position];
                }
                catch (IndexOutOfRangeException) {
                    throw new InvalidOperationException();
                }
            }
        }
    }
}
